package com.hxci.swn.controller;
import com.hxci.swn.dao.StudentswnDao;
import com.hxci.swn.pojo.Studentswn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("tea")
public class StudentswnController {
    @Autowired
    StudentswnDao studentDao;

    //@RequestMapping("query")
    public String query(Model model){
        List<Studentswn> list = studentDao.query();
        model.addAttribute("list",list);
        return "list";
    }
    @RequestMapping("add")
    public String add(){

        return "add";
    }
    @RequestMapping("save")
    public String save(Studentswn studentswn){
        int a =studentDao.save(studentswn);
        return "redirect: query";
    }
    @RequestMapping("del")
    public String del(Integer idswn) {
        int a = studentDao.del(idswn);
        return "redirect: query";
    }
    @RequestMapping("index")
    public String index(){

        return "index";
    }

}